export function exportExcel(tHeaderName1,tHeaderName2,tableData, title) {   //  参数(表头的文字，表头的数据，数据，excel的文件名字)
    require.ensure([], () => {
        const { export_json_to_excel } = require("../../excel/Export2Excel");

        //const tHeader = ["凭证代码", "机构","车主姓名","录入时间","支付金额","支付状态","支付方式","驳回理由","审核状态"];// 上面设置Excel的表格第一行的标题
    
        //const tHeaderName2 = ["order_number","group_name","information","create_at","totalPrice","pay_status","pay_types","reasons","audit_status"]; // 上面的index、nickName、name是tableData里对象的属性
        
        const list = tableData;              //把data里的tableData存到list

        const data = exportFormatJson(tHeaderName2, list);
        
        // export_json_to_excel(tHeader, data, "畅行无忧凭证");   //标题，数据，文件名
        export_json_to_excel(tHeaderName1, data, title);   //标题，数据，文件名

    });
}

export function exportFormatJson(filterVal, jsonData) {
    return jsonData.map(v => filterVal.map(j => v[j]));
}

export default {
	exportExcel
}